package Excel;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;

public class test {
    public static void main(String[] args) {
        //实现写操作
        //1.设置写入的文件夹地址和excel文件名称
        String filename = "F:\\write.xlsx";
        //2.调用easyexcel中方法
        EasyExcel.write(filename, entity.class).sheet("学生列表").doWrite(getlist());
    }

    //public static void main(String[] args) {
    //    String filename = "F:\\write.xlsx";
    //    EasyExcel.read(filename, entity.class, new excelListener()).sheet().doRead();
    //}

    private static List<entity> getlist() {
        List<entity> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            entity entity = new entity();
            entity.setSno(i);
            entity.setSname("zzz" + i);
            list.add(entity);
        }
        return list;
    }
}